function createCatalogue(){
    //给所有标题配好id，便于锚点定位
    var id = 1;
    $.each($('.cms-article').find('h2,h3,h4,h5,h6'),function(k,v){
        var idPos = v.getInnerHTML().indexOf('id=');
        if (idPos != -1) {
            v.id = v.getInnerHTML().substr(idPos + 3);
            v.innerText = v.getInnerHTML().substr(0, idPos - 1);
        } else {
            v.id = 'catalogue' + id++;
        }
    });
    var catalogue = "";
    $.each($('.cms-article').find('h2,h3,h4,h5,h6'),function(k,v){
        catalogue = catalogue + "<li><a href='#" + v.id + "' class='cms-anchor-" + v.tagName + "'>" + v.innerText + "</a></li>";
    });
    $(".cms-anchor ul").empty().append(catalogue);
}
createCatalogue();